package com.yc.shopping.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.yc.shopping.util.DBHelper;

public class MemberDao {
	
	/**
	 * 修改积分
	 * @param tel
	 * @param score
	 * @return
	 * @throws SQLException
	 */
	public int updateScore(String tel,int score) throws SQLException {
		String sql = "update tb_member set score = score + ? where mid =?";
		return DBHelper.update(sql, score,tel);
	}
	/**
	 * 查看所有会员信息
	 * @return
	 * @throws SQLException
	 */
	public List<Map<String , Object>> selectMemberMessage() throws SQLException{
		String sql ="select mid , name ,birthday ,score ,state from tb_member ";
		return DBHelper.selectListMap(sql);
	}
	/**
	 * 查看具体会员信息
	 * @param mid
	 * @return
	 * @throws SQLException
	 */
	public List<Map<String,Object>> selectOneMember(String mid) throws SQLException{
		String sql = "select mid , name ,birthday ,score ,state from tb_member where mid = ?";
		return DBHelper.selectListMap(sql, mid);
	}
}
